-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: solve the smooth scrolling scene, the y value obtained is the data 100ms ago #1439
base: master
Are you sure you want to change the base?
Conversation
|
When listening to the scroll event, the x and y data of the node cannot be obtained because the target cannot be obtained through |
...arg, | ||
target: arg.target | ||
} | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this argument transformation something specific to MouseEvent/TouchEvent/DragEvent ?
I think this needs a bit more explanation; the T
type here is supposed to be generic, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still wondering why we need to do the transformation?
is it that an explicit reference to the target
needs to be saved before the timeout?
I would have thought that args
being in a closure should handle saving the reference?
packages/rrweb/src/utils.ts
Outdated
timeout = null; | ||
func.apply(context, args); | ||
if (timeout) { | ||
clearTimeout(timeout) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't see why you need to clear the timeout here as it is a 'one-shot' timeout.
clearing it would make sense if it was setInterval
, but it seems to me that it's already been called and won't be called again?
Is there some concurrency or similar here that is possible?
In the smooth scrolling scene on the mobile phone, the y value obtained by the monitored scroll event is too small, causing the bottom content to be invisible during playback.